package com.eunion.web.admin.entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

/**
 * 系统用户
 */
@Entity
@Table(name = "admin_user")
public class AdminUser implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用户名
     */
    @NotNull(message = "用户名非法")
    @NotEmpty(message = "用户名不能为空")
    @Size(min = 2, max = 20, message = "数据长度非法2-20")
    @Pattern(regexp = "^[a-zA-Z0-9]{2,20}$", message = "用户名仅允许2－20位英文及数字或下划线")
    @Id
    private String username;

    /**
     * 登录密码
     */
    private String password;

    /**
     * 邮箱
     */
    // @Pattern(regexp = "[a-zA-Z_]{1,}[0-9]{0,}@(([a-zA-z0-9]-*){1,}\\.){1,3}[a-zA-z\\-]{1,}", message = "请输入正确格式的邮箱")
    private String email;

    /**
     * 手机
     */
    // @Pattern(regexp = "^(1[3-9])\\d{9}$", message = "请输入正确手机号码")
    private String mobile;

    /**
     * 状态，0：停用，1：启用
     */
    private Byte status;

    /**
     * 微信的openid
     */
    @Column(name = "wx_id")
    private BigInteger wxId;

    /**
     * 创建时间
     */
    @Column(name = "created_time")
    private Timestamp createdTime;

    /**
     * 创建人用户名
     */
    @Column(name = "created_by")
    private String createdBy;

    /**
     * 更新时间
     */
    @Column(name = "updated_time")
    private Timestamp updatedTime;

    /**
     * 更新人用户名
     */
    @Column(name = "updated_by")
    private String updatedBy;

    /**
     * 新密码
     */
    @Transient
    private String passwordNew;

    /**
     * 确认新密码
     */
    @Transient
    private String passwordNewRepet;

    public AdminUser() {
    }

    public AdminUser(String username, String password, Byte status) {
        super();
        this.username = username;
        this.password = password;
        this.status = status;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public Byte getStatus() {
        return status;
    }

    public void setStatus(Byte status) {
        this.status = status;
    }

    public BigInteger getWxId() {
        return wxId;
    }

    public void setWxId(BigInteger wxId) {
        this.wxId = wxId;
    }

    public Timestamp getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Timestamp createdTime) {
        this.createdTime = createdTime;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public Timestamp getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(Timestamp updatedTime) {
        this.updatedTime = updatedTime;
    }

    public String getUpdatedBy() {
        return updatedBy;
    }

    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    public String getPasswordNew() {
        return passwordNew;
    }

    public void setPasswordNew(String passwordNew) {
        this.passwordNew = passwordNew;
    }

    public String getPasswordNewRepet() {
        return passwordNewRepet;
    }

    public void setPasswordNewRepet(String passwordNewRepet) {
        this.passwordNewRepet = passwordNewRepet;
    }

}
